<template>
	<view class="p-bot20">
		<!-- #ifdef MP-WEIXIN -->
		<navBar :bgMake="5" :Color="2" :fromShare="fromShare" :title="title"></navBar>
		<!-- #endif -->
		<view class="viewbox auto m-top20" v-if="pageData.length">
			<block v-for="(item,index) in pageData" :key="index">
				<view class="rows bgwhite padding20 bor_radius_10 m-bot20"
					@click="toUrl(`/User/introduce?id=${item.website_article_id}`)">
					<view class="EventsBox m-bot16" v-if="item.website_article_img">
						<image :src="$imgUrls(item.website_article_img)" mode="widthFix" class="rows"></image>
					</view>
					<text class="ellipsis_3 black size30 bold  line40" selectable>{{item.website_article_title}}</text>
					<text class="rows color_33 h6 m-top10"
						v-if="item.website_article_info">{{item.website_article_info}}</text>
				</view>

			</block>
		</view>
		<Events v-else title="暂无相关内容~"></Events>
		<Load v-if="Load"></Load>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				Load: true,
				title: '',
				fromShare: 0,
				page: 1,
				pagecount: 10,
				getMore: true,
				pageData: [],
				listId: '',
			}
		},
		onLoad(opt) {
			if (opt.listId) this.listId = opt.listId;
			this.getArticle();
		},
		methods: {
			getArticle() {
				this.$http.post({
					url: '/zzj_singleSaleApi/getArticle',
					data: {
						listId: this.listId,
						page: this.page,
						pagecount: this.pagecount
					}
				}).then(res => {
					this.Load = false;
					if (res.errcode != '00000') return;
					const result = res.data || [];
					this.title = res.title;
					this.$BarTitle(res.title);
					this.page == 1 ? this.pageData = result : this.pageData = this.pageData.concat(result);
					if (result.length < this.limit) this.getMore = false;
				})
			}
		},
		computed: {
			...mapState(['share']),
		},
		onReachBottom() {
			if (!this.getMore) return;
			this.page++;
			this.getArticle();
		},
		onShareAppMessage() {
			let share = this.share;
			return {
				title: share.title,
				desc: share.desc,
				path: `/pages/startUp/startUp?share_v_id=${this.vid}`,
				imageUrl: share.imageUrl
			}
		},
	}
</script>
<style lang="scss">
	page {
		background-color: $pageBg;
	}
</style>
<style lang="scss" scoped>

</style>